<!DOCTYPE html>
<html lang="en">
<head>
    {include file="public/meta" /}
    {include file="public/link" /}
</head>
<body data-type="index" class="theme-white">
<div class="am-g tpl-g">
    {include file="public/header" /}
    {include file="public/left" /}
    {include file="public/content_top" /}
    <ol class="am-breadcrumb">
        <li><a href="../home/index.html" class="am-icon-home">首页</a></li>
        <li><a href="../user/index.html">用户管理</a></li>
        <li class="am-active"><a href="../users/recharge_record.html?a={$a}&b={$b}">充值记录</a></li>
    </ol>

    <div class="am-form-inline" role="form">

            <span>日期范围：</span>

            <div class="am-form-group ">

                <input type="text" class="am-form-field am-input-sm" name="start" placeholder="请选择起始日期"

                       data-am-datepicker onfocus="this.blur()" value="{$arr.start_query}"/>

            </div>

            <div class="am-form-group ">

                <input type="text" class="am-form-field am-input-sm" name="end" placeholder="请选择结束日期" data-am-datepicker

                       onfocus="this.blur()" value="{$arr.end_query}"/>

            </div>

            <div class="am-form-group ">

                <input type="text" id="name" class="am-form-field am-input-sm" placeholder="请输入用户名称或手机号"

                       value="{$arr.name}"/>

            </div>

            <button type="button" class="am-btn am-btn-primary am-btn-sm" onclick="info_query()">查询</button>

            <button type="button" class="am-btn am-btn-warning am-btn-sm" onclick="clear_query()">清除查询</button>
            <!-- ,array('excel'=>1,'name'=>$name,'start_query'=>$start_query,'end_query'=>$end_query)) -->
            <a href="{:url('recharge_record')}?excel=1&name={$name}&start_query={$start_query}&end_query={$end_query}">导出Excel表格</a>
            <!-- <button type="button" class="am-btn am-btn-primary am-btn-sm" style="margin-left: 200px: " onclick="Derive_excel()">导出Excel表格</button> -->

    </div>

    <div class="widget am-cf">
        <hr data-am-widget="divider" class="am-divider am-divider-default"/>
        <div class="widget-body widget-body-lg am-fr">
            <div class="am-scrollable-horizontal">
                <table class="{$table}">
                    <thead>
                    <tr>
                        <th>账户ID</th>
                        <th>用户姓名</th>
                        <th>手机号</th>
                        <th>充值金额</th>
                        <th>手续费</th>
                        <th>实际到账金额</th>
                        <th>创建时间</th>
                        <th>充值类型</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody id="list">
                    {volist name="list" id="vo" empty="$empty"}
                    <tr>
                        <td>{$vo.uid}</td>
                        <td>{$vo.user.name}</td>
                        <td>{$vo.user.phone}</td>
                        <td>{$vo.number}</td>
                        <td>{$vo.fee}</td>
                        <td>{$vo.number - $vo.fee}</td>
                        <td>{$vo.time}</td>
                        <td>{$vo['type'] == 1?'后台充值':'前台充值'}</td>
                        <td>
                            <a href="#"  onclick="del(id={$vo['id']})" class="am-btn am-btn-success am-btn-xs">删除</a>
                        </td>
                    </tr>
                    {/volist}
                    </tbody>
                </table>
                <div class="am-pagination-left">{$page}</div>
            </div>
        </div>
    </div>
</div>
{include file="public/foot" /}
<script type="text/javascript">
    function del(id) {
        if (confirm("确定要删除吗？")) {
            $.ajax({
                url: "{:url('Users/del')}",
                data: {id:id},
                type: "post",
                success: function (r) {
                    if (r['code'] == 1) {
                        alert_open(r['msg'])
                    } else {
                        alert_msg(r['msg']);
                    }
                }
            });
            return true;
        } else {
            return false;
        }
    }
    // function del(id) {
    //     if (confirm("确定要删除吗？")) {
    //         $.ajax({
    //             url: "{:url('del')}",
    //             type: "post",
    //             data: {id: id},
    //             success: function (r) {
    //                 if (r == 1) {
    //                     alert_msg('操作成功');
    //                     setTimeout(location.reload(),50000);
    //                 } else {
    //                     alert_msg('操作失败');
    //                 }
    //             }
    //         });
    //     } else {
    //         return false;
    //     }
    // }

    $(function () {
        var nav = $('.left-sidebar li.sidebar-nav-link');
        nav.removeClass("active");
        nav.eq({$a}).find('ul').show();
        nav.eq({$a}).find('ul li').eq({$b}).find('a').addClass('active');
    });
</script>
</body>
</html>